﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Login.aspx.cs" Inherits="AB_SD_MockProject.Login" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Login</title>
    <link href="Style/login.css" rel="Stylesheet" />
    <script type="text/javascript">
        function ForgotPassword() {
            el = document.getElementById("dialogmask");
            el.style.visibility = (el.style.visibility == "visible") ? "hidden" : "visible";
        }

        function submitForgotPassword() {
            var username = document.getElementById("txtForgotPasswordUsername").value;
            var email = document.getElementById("txtForgotPasswordEmail").value;
            var sendStr = "username=" + username + "&email=" + email;

            var request;
            if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
                request = new XMLHttpRequest();
            }
            else {// code for IE6, IE5
                request = new ActiveXObject("Microsoft.XMLHTTP");
            }
                        
            // Specify the POST method and send it.
            request.open("POST", "ForgotPassword.aspx");
            request.onreadystatechange = function () {
                var msgDiv = document.getElementById("ForgotPassMsgs");
                msgDiv.innerHTML = request.responseText;

            };
            request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
            request.setRequestHeader("ForgotPassword", "true");
            request.send(sendStr);
        }
    </script>
</head>
<body>
<form id="frmLogin" runat="server">            
    <div id="wrapper">        
        <div id="dialogmask">
            <div id="ForgotPasswordForm">
                <div class="header">
                    Forgot password
                    <p>Enter your username and email</p>
                </div>
                <div class="body">
                    <input type="text" id="txtForgotPasswordUsername" class="textbox" value="Username" onfocus="this.value='';" onkeydown="if (event.keyCode == 13) { submitForgotPassword(); return false; }"/>
                    <input type="text" id="txtForgotPasswordEmail" class="textbox" value="Email" onfocus="this.value='';" onkeydown="if (event.keyCode == 13) { submitForgotPassword(); return false; }"/>
                </div>
                <div class="footer">                    
                    <div class="buttons">
                        <input type="button" id="cmdForgotPasswordSubmit" class="button" onclick="submitForgotPassword();" value="Submit"/>                        
                        <input type="button" id="cmdCancel" name="Cancel" value="Cancel" class="button" onclick="ForgotPassword()"/>
                    </div>
                </div>
                <div class="messages" id="ForgotPassMsgs">                                
                </div>      
            </div>
        </div>
        <div id="LoginForm">
            <div class="header">Login Form</div>
            <div class="body">
                <asp:TextBox TextMode="SingleLine" ID="txtUsername" runat="server" CssClass="textbox"/>
                <asp:TextBox TextMode="Password" ID="txtPassword" runat="server" CssClass="textbox"/>
            </div>
            <div class="footer">
                <div class="options">
                    <asp:CheckBox ID="chkRemember" Text="Remember me" runat="server"/>
                    <p class="forgotpass" onclick="ForgotPassword()">Forgot password?</p>
                </div>
                <div class="buttons">
                    <asp:Button ID="cmdLogin" Text="Login" CssClass="button" runat="server" 
                            ValidationGroup="LoginValidation" onclick="cmdLogin_Click"/>                        
                </div>
            </div>
            <div class="messages">                
                <div class="validate-msg"><asp:CustomValidator ID="vldLogin" runat="server" 
                    ErrorMessage="Invalid username or password" ValidationGroup="LoginValidation" 
                    onservervalidate="vldLogin_ServerValidate" Display="Dynamic"></asp:CustomValidator></div>
                <div class="validate-msg"><asp:RequiredFieldValidator ID="vldUsernameRequired" ControlToValidate="txtUsername" runat="server" ErrorMessage="Please enter username!" Display="Dynamic" ValidationGroup="LoginValidation" CssClass="validate-msg"></asp:RequiredFieldValidator></div>
                <div class="validate-msg"><asp:RequiredFieldValidator ID="vldPasswordRequired" ControlToValidate="txtPassword" runat="server" ErrorMessage="Please enter password!" Display="Dynamic" ValidationGroup="LoginValidation" CssClass="validate-msg"></asp:RequiredFieldValidator></div>
                <div class="validate-msg"><asp:RegularExpressionValidator ID="vldUsernameRE" ControlToValidate="txtUsername" runat="server" ValidationExpression="([a-z]|[A-Z]|[0-9]|[@]|[-]|[_])*" ErrorMessage="Username can not contain special characters (only [A-Z], [a-z], [0-9], '-', '_', '@' are allowed)" Display="Dynamic" ValidationGroup="LoginValidation" CssClass="validate-msg" ></asp:RegularExpressionValidator></div>
                <div class="validate-msg"><asp:RegularExpressionValidator ID="vldPasswordRE" ControlToValidate="txtPassword" runat="server" ValidationExpression="([a-z]|[A-Z]|[0-9]|[@]|[-]|[_])*" ErrorMessage="Password can not contain special characters (only [A-Z], [a-z], [0-9], '-', '_', '@' are allowed)" Display="Dynamic" ValidationGroup="LoginValidation" CssClass="validate-msg"></asp:RegularExpressionValidator></div>
            </div>      
        </div>                           
    </div>    
</form>    
</body>
</html>
